{{include file="../tools/jquery_validator2.htm"}} 
{{include file="../tools/upload.htm"}} 
<style>
.box{width:150px !important;}
</style>
<script type="text/javascript">
     $(function () {
		
		Main.setCnTime()
		$(".dates").datepicker({changeMonth:true,changeYear:true, yearRange:"1970:2010"});
		var swf = swfUpload({
					   size:10,
					   limit:1,
					   type:'*.jpg;*.png;*.gif',
					   button_id:'avater',
					  // debug:true,
					  
					   index:0,   //第几个实例
					   set_input:true, //是否将文件信息写到input中（json）
					   data_type:'text'
				   });
		
		 
           
 });
</script>
{{if $session.user_info}}

<script>
$(function(){
   $('#user_register').validate({

				rules: {
					user_name: {
						minlength: 2,
						maxlength: 16,
						required: true,
						regexp:/^[^\W]+$/
						
		
					},
					passwd: {
						minlength: 2,
						required: true
		
					},
					passwd2: {
						minlength: 2,
						required: true,
						equalTo:"#passwd"
		
					}
					,
					name: {
						minlength: 2,
						required: true
						
		
					}
					,
					nick_name: {
						minlength: 2,
						required: true
		
					}
					,
					type_id: {
						
						required: true,
						digits:true
		
					}
				
					,
					tel: {
						minlength: 2,
						required: true,
						regexp:/^\d{11}$/
		
					}
					,
					email: {
						minlength: 2,
						required: true,
						email:true
		
					}
					
					,
					wenxin: {
						minlength: 2,
						required: true
		
					},
					birthday: {
						minlength: 2,
						required: true
		
					},
					sex: {
						minlength: 1,
						required: true
		
					}
					
				},
		
				messages: {
					user_name: {
						regexp:'只允许输入16个字母和数字'
						
						
					},
					passwd2: {
						equalTo:"两次密码不匹配!"
					},
					email: {
						email:"Email格式错误!"
						
		
					},
					tel: {
						digits:"请输入正确的手机号码!"
		
					},
					birthday: {
						
						required: '请填写生日'
		
					},
					sex: {
						
						required: '请选择性别'
		
					}
					
					
        	},
			success: function(element) {
				element
				.text('OK!').addClass('valid')
				.closest('.control-group').removeClass('error').addClass('success');
  			}
    	});	
})
</script>
{{else}}
<script>
$(function(){
   $('#user_register').validate({
				onblur:true,
				rules: {
					user_name: {
						minlength: 2,
						maxlength: 16,
						required: true,
						regexp:/^[^\W]+$/
						,ajaxCheck:{act:'is_register',field:'user_name',rev:true}
		
					},
					passwd: {
						minlength: 2,
						required: true
		
					},
					passwd2: {
						minlength: 2,
						required: true,
						equalTo:"#passwd"
		
					}
					,
					name: {
						minlength: 2,
						required: true
						
		
					}
					,
					nick_name: {
						minlength: 2,
						required: true
		
					}
					,
					type_id: {
						
						required: true,
						digits:true
		
					}
				
					,
					tel: {
						minlength: 2,
						required: true,
						regexp:/^\d{11}$/
		
					}
					,
					email: {
						minlength: 2,
						required: true,
						email:true,
						ajaxCheck:{act:'is_register',field:'email',rev:true}
		
					}
					,
				
					wenxin: {
						minlength: 2,
						required: true
		
					}
					,birthday: {
						minlength: 2,
						required: true
		
					},
					sex: {
						minlength: 1,
						required: true
		
					}
					
				},
		
				messages: {
					user_name: {
						regexp:'只允许输入16个字母和数字',
						ajaxCheck:'用户名已经存在!，请重新输入!'
						
					},
					passwd2: {
						equalTo:"两次密码不匹配!"
					},
					email: {
						email:"Email格式错误!",
						ajaxCheck:'Email已经存在!，请重新输入!'
		
					},
					tel: {
						digits:"请输入正确的手机号码!"
		
					},
					birthday: {
						
						required: '请填写生日'
		
					},
					sex: {
						
						required: '请选择性别'
		
					}
					
					
        	},
			success: function(element) {
				element
				.text('OK!').addClass('valid')
				.closest('.control-group').removeClass('error').addClass('success');
  			}
    	});	
})
</script>
{{/if}}
<div class="userbox">
  <h2>用户信息</h2>
  <div class="left">
    <form name="register" id="user_register" method="post" >
      <table>
        <tr>
          <td><em>&#42;</em></td>
          <td width="80">用&nbsp;&nbsp;户&nbsp;&nbsp;名：</td>
          <td width="450" class="ts ts1"><input type="text" name="user_name" value="{{$user_info.user_name}}" {{if $session.user_info}} readonly="readonly"{{/if}} />
           </td>
        </tr>
        <tr>
          <td><em>&#42;</em></td>
          <td>密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码：</td>
          <td><input type="password" name="passwd" id="passwd" /></td>
        </tr>
        <tr>
          <td><em>&#42;</em></td>
          <td>确认密码：</td>
          <td><input type="password"/ name="passwd2" id="passwd2"></td>
        </tr>
        <tr>
          <td><em>&#42;</em></td>
          <td>真实姓名：</td>
          <td><input type="text" name="name"  id="name" value="{{$user_info.info.name}}"/></td>
        </tr>
        <tr>
          <td><em>&#42;</em></td>
          <td>昵&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;称：</td>
          <td><input type="text" name="nick_name" id="nick_name" value="{{$user_info.info.nick_name}}"/></td>
        </tr>
        <tr class="jigou">
          <td><em>&#42;</em></td>
          <td>所在机构：</td>
          <td><select name="type_id" id="type_id">
              <option value="">请&nbsp;&nbsp;选&nbsp;&nbsp;择</option>
              
         	{{foreach from=$typeids item=list key=key}}
            
              <option value="{{$list.type_id}}" {{if $user_info.type_id==$list.type_id}}selected="selected"{{/if}}>{{$list.name}}</option>
              
            {{/foreach}}
         
          
            </select></td>
        </tr>
        <tr>
          <td><em> </em></td>
          <td>头&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;像：</td>
          <td>
          
         {{if $user_info.avater}}
        
        	{{$default[0]['url']=$user_info.avater}}
     	  {{else}}
         	{{$default[0]['url']='templates/default/images/avater.jpg'}}
       	{{/if}}
          {{$default=json_encode($default)}}
         <div id="avater_default" class="none">{{$default}}</div>
      
           <div id="avater"> </div>
          <div id="avater_res">
       
          </div>
            <input type="text" name="avater" id="avaters" class="size0" value="{{if $user_info.avater}}{{$user_info.avater}}{{else}}{{$t_path}}/images/avater.jpg{{/if}}"/> </td>
        </tr>
        <tr>
          <td><em>&#42;</em></td>
          <td>手&nbsp;&nbsp;机&nbsp;&nbsp;号：</td>
          <td  class="ts ts2"><input type="text" name="tel" value="{{$user_info.info.tel}}"/></td>
        </tr>
        <tr>
          <td><em>&#42;</em></td>
          <td>邮&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;箱：</td>
          <td><input type="text" name="email" value="{{$user_info.email}}" {{if $session.user_info}} readonly="readonly"{{/if}}/></td>
        </tr>
        <tr>
          <td><em>&#42;</em></td>
          <td>性&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;别：</td>
          <td><input type="radio" name="sex" value="1" {{if $user_info.sex=='1'}}checked="checked"{{/if}}/>
            男
            <input type="radio" name="sex" value="2" {{if $user_info.sex=='2'}}checked="checked"{{/if}}/>
            女</td>
        </tr>
        <tr class="shri">
          <td><em>&#42;</em></td>
          <td>生&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;日：</td>
          <td><input type="text" name="birthday" class="dates" readonly="readonly" value="{{$user_info.birthday}}"/></td>
        </tr>
        <tr>
          <td><em> </em></td>
          <td>微&nbsp;&nbsp;信&nbsp;&nbsp;号：</td>
          <td><input type="text" name="weixin"   value="{{$user_info.info.weixin}}"/></td>
        </tr>
        <tr>
          <td><em> </em></td>
          <td></td>
          <td><input  type="hidden" value="register" name="user_act"/>
            <input  type="hidden" value="{{$user_info.user_id}}" name="user_id"/>
            <input  class="zhuce"  type="submit" value="" id="button"/></td>
        </tr>
        <tr>
          <td><em> </em></td>
          <td></td>
          <td><em>&#42;</em> 为必填选项</td>
        </tr>
      </table>
    </form>
  </div>
  {{if !$no_style}}
  <!--left end--> 

  {{include file="./user_act_right.htm"}} 
  <!--right end--> 
  {{/if}}
</div>
